//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.dstz.bpm.engine.action.handler.task;

import com.dstz.base.api.exception.BusinessMessage;
import com.dstz.bpm.api.constant.ActionType;
import com.dstz.bpm.api.constant.TaskStatus;
import com.dstz.bpm.core.manager.BpmTaskManager;
import com.dstz.bpm.core.model.BpmTask;
import com.dstz.bpm.engine.action.cmd.DefualtTaskActionCmd;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class TaskUnlockActionHandler extends AbstractTaskActionHandler<DefualtTaskActionCmd> {
   @Resource
   BpmTaskManager aN;

   public TaskUnlockActionHandler() {
   }

   public ActionType getActionType() {
      return ActionType.UNLOCK;
   }

   @Override
   public void execute(DefualtTaskActionCmd model) {
     // this.f(model);
      this.l(model);
      BpmTask task = (BpmTask)model.getBpmTask();
      if (!task.getStatus().equals(TaskStatus.LOCK.getKey())) {
         throw new BusinessMessage("该任务并非锁定状态,或已经被解锁，解锁失败");
      } else {
         this.aN.unLockTask(task.getId());
      }
   }

   @Override
   protected void b(DefualtTaskActionCmd var1) {

   }


   public void g(DefualtTaskActionCmd actionModel) {
   }

   public int getSn() {
      return 6;
   }

   public Boolean isDefault() {
      return false;
   }

   @Override
   public String getDefaultGroovyScript() {
      return "return task.getStatus().equals(\"LOCK\");";
   }

   public String getConfigPage() {
      return "";
   }
}
